package com.iflytek.aisol.audit.iflytek.strategy.manage.controller;

import com.iflytek.aisol.audit.iflytek.strategy.manage.common.entity.R;
import com.iflytek.aisol.audit.iflytek.strategy.manage.dto.EngineParamDTO;
import com.iflytek.aisol.audit.iflytek.strategy.manage.dto.ServerInstanceDTO;
import com.iflytek.aisol.audit.iflytek.strategy.manage.entity.EngineParam;
import com.iflytek.aisol.audit.iflytek.strategy.manage.query.PageDTO;
import com.iflytek.aisol.audit.iflytek.strategy.manage.query.ServicePageQuery;
import com.iflytek.aisol.audit.iflytek.strategy.manage.query.ServiceVO;
import com.iflytek.aisol.audit.iflytek.strategy.manage.service.EngineParamService;
import com.iflytek.aisol.audit.iflytek.strategy.manage.service.impl.EngineParamServiceImpl;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/engineParam")
@Slf4j
public class EngineParamController {
    @Autowired
    private EngineParamService engineParamService;

    /**
     * 新增引擎参数配置接口
     */
    @PostMapping
    @ApiOperation(value = "engineParam 新增配置")
    public R<?> add(@RequestBody EngineParamDTO engineParamDTO){
        log.info("插入的数据为：{}", engineParamDTO);
        engineParamService.add(engineParamDTO);
        return R.success();
    }
    /**
     * 修改引擎参数配置接口
     * @param id 根据id修改
     * @param engineParamDTO 前端传入的
     * @return
     */
    @PutMapping("/{id}")
    @ApiOperation(value = "engineParam 修改配置")
    public R<?> update(@PathVariable Long id, @RequestBody EngineParamDTO engineParamDTO){
        engineParamService.update(id,engineParamDTO);
        return R.success();
    }

    /**
     * 删除引擎参数配置接口
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    @ApiOperation(value = "engineParam 删除配置")
    public R<?> delete(@PathVariable Long id){
        engineParamService.delete(id);
        return R.success();
    }

    /**
     * 根据id查询
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "engineParam 查询")
    public R<EngineParamDTO> queryServicePage(@PathVariable Long id) {
        EngineParamDTO e = engineParamService.query(id);
        return R.success(e);
    }


}
